
// 存取token
export default {
  data() {
    return {
		codeTime:''
    }
  },
  onLoad(){

  },
  onUnload(){
	// clearInterval(this.codeTime)   
  },
  methods: {
		// 获取打卡核销情况
		async getWriteOff(e){
			try{
				let data = {
					equityCardId: e.equityCardId,
					verificationKey: e.verificationKey
				}
				var res = await this.$api.verificationResult(data)
				if(res.result!=''){
					var writeInfo = res.result
					clearInterval(this.codeTime)
					this.$queue.setData('writeInfo',writeInfo)
					if(res.result.assistanceStageOrderId !='' ){
						uni.navigateTo({
							url:'/pages/subPackages/pagesC/order/peerAssistance/peerAssistance?id='+res.result.assistanceStageOrderId
						})
						
					}else{
						this.$queue.setData('writeInfo',writeInfo)
						uni.navigateTo({
							url:'/pages/subPackages/pagesD/paymentPage/paymentPage'
						})
					}
				}
			}catch(err){
				if(err.code === -9998){
					clearInterval(this.codeTime)
				}
			}
		},
		//轮询请求核销情况
		circulateWriteOff(item) {
			var that = this
			clearInterval(this.codeTime)
			that.codeTime = setInterval(function() {
				that.getWriteOff(item)
			}, 2000)
		},
		// 清除循环
		clearIntervalOff(){
			clearInterval(this.codeTime)  
		}
  }
}
